﻿<phone:PhoneApplicationPage
    x:Class="zhangkong.CoursePageSettings"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:zhangkong="clr-namespace:zhangkong"
    xmlns:system="clr-namespace:System;assembly=mscorlib"
    d:DataContext="{d:DesignData SampleData/BackgroundList.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True"
    shell:SystemTray.Opacity="0"
    shell:SystemTray.ForegroundColor="Snow"
    toolkit:TiltEffect.IsTiltEnabled="True"
    >

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <phone:PhoneApplicationPage.Resources>
        <zhangkong:PathToImage x:Key="StringToImage"/>
        <DataTemplate x:Key="BackgoundImageDataTemplate">
            <Grid>
                <Image Margin="1,1,11,1" Source="{Binding FilePath, Converter={StaticResource StringToImage}}"></Image>
            </Grid>
        </DataTemplate>
        <Style x:Key="ButtonStyle2" TargetType="Button">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
            <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/>
            <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/>
            <Setter Property="Padding" Value="10,5,10,6"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid Background="Transparent">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver"/>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" Margin="{StaticResource PhoneTouchTargetOverhang}">
                                <ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </phone:PhoneApplicationPage.Resources>



    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>




        <!--TitlePanel 包含应用程序的名称和页标题-->
        <StackPanel Grid.Row="0" Margin="12,17,0,10">
            <TextBlock Text="掌控校园" Foreground="White" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="设置" Foreground="White" Margin="9,-7,0,0" Style="{StaticResource PhoneTextLargeStyle}"/>
        </StackPanel>
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

            <ProgressBar IsIndeterminate="True" Foreground="White" x:Name="ProgressBar" Visibility="Collapsed"></ProgressBar>
            <ScrollViewer Margin="0,0,12,0">
                <StackPanel>
                    <TextBlock Text="动态磁贴" Style="{StaticResource PhoneTextNormalStyle}" Foreground="White" FontSize="30" Opacity="0.8"/>
                    <toolkit:ToggleSwitch x:Name="TileToggleSwitch" 
                                          IsChecked="True"
                                          SwitchForeground="CadetBlue" 
                                          Foreground="White"
                                          Margin="0,-20,0,-10"
                                          Checked="DynamicTile_Checked"
                                          Unchecked="DynamicTile_UnChecked"
                                          BorderBrush="White"
                                          />


                    <TextBlock Text="每天最大课程数" Style="{StaticResource PhoneTextNormalStyle}" Foreground="White" FontSize="30" Opacity="0.8"/>
                    <toolkit:ListPicker BorderBrush="White" Foreground="White" Opacity="0.8" x:Name="MaximumCoursesListPicker" SelectionChanged="ReparseData_SelectionChanged">
                        <system:String>11</system:String>
                        <system:String>12</system:String>
                    </toolkit:ListPicker>




                    <TextBlock Text="背景" Style="{StaticResource PhoneTextNormalStyle}" Foreground="White" FontSize="30" Opacity="0.8"/>
                    <phone:LongListSelector 
                                            ItemTemplate="{StaticResource BackgoundImageDataTemplate}"
                                            ItemsSource="{Binding ImageList}"
                                            GridCellSize="140,270"
                                            LayoutMode="Grid"
                                            Margin="12,0,0,0"
                                            SelectionChanged="ChangeBackgroundUri_SelectionChangd"
                                            />

                    <Button Foreground="White" BorderBrush="White" Content="选择图片" Style="{StaticResource ButtonStyle2}" Click="ChoosePictureFromAlbum_Click"></Button>
                </StackPanel>
            </ScrollViewer>
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>